package com.ninetaildemonfox.zdl.socialproject.mvp.presenter;

import android.support.v7.app.AppCompatActivity;

import com.google.gson.JsonObject;
import com.ninetaildemonfox.zdl.socialproject.http.https.Model;
import com.ninetaildemonfox.zdl.socialproject.mvp.contract.AforInvitationContract;
import com.ninetaildemonfox.zdl.socialproject.utils.ToastUtil;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * 创建人： Nine tails fox
 * 创建时间： 2019/8/5
 * 功能描述：
 * 联系方式：1037438704@qq.com
 *
 * @author NineTailDemonFox
 */

public class AforInvitationPresenter {
    private AforInvitationContract aforInvitationContract;
    private AppCompatActivity me;

    public AforInvitationPresenter(AforInvitationContract aforInvitationContract, AppCompatActivity me) {
        this.aforInvitationContract = aforInvitationContract;
        this.me = me;
    }

    public void getAddApply(String token, String city, String where, String phone, String parent){
        if (token == null){
            ToastUtil.show("登录失效");
            return;
        }
        if (city == null){
            ToastUtil.show("请输入城市");
            return;
        }
        if (where == null){
            ToastUtil.show("请输入您获取的渠道");
            return;
        }
        if (phone == null){
            ToastUtil.show("请输入电话");
            return;
        }
        Model.getInstance()
                .getUserApi()
                .getAddApply(token,city,where,phone,parent)
                .enqueue(new Callback<JsonObject>() {
            @Override
            public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
            }

            @Override
            public void onFailure(Call<JsonObject> call, Throwable t) {

            }
        });
    }

}
